import threading
import time
#多个线程并发执行

class SubThread(threading.Thread):
    def run(self):
        for i in range(3):#创建三个线程
            time.sleep(1)
            print(f'线程{threading.current_thread().name}正在执行{i}')


if __name__ == '__main__':
    print('主线程开始执行')
    lst = [SubThread() for i in range(2)]
    for item in lst:
        item.start()
    for item in lst:
        item.join()
    print('主线程执行完毕')
